﻿Imports TransportadoraToledoDAL

Public Class ContasReceberBLL
    Dim objDAL As ContasReceberDAL

    Private CodigoContasReceber As Integer
    Public Property pCodigoContasReceber() As Integer
        Get
            Return CodigoContasReceber
        End Get
        Set(ByVal value As Integer)
            CodigoContasReceber = value
        End Set
    End Property


    Function localizaAbertos(ByVal dataInicio As Date, ByVal dataFinal As Date) As DataTable
        objDAL = New ContasReceberDAL
        Dim tab As New DataTable
        Try
            tab = objDAL.LocalizaAbertos(dataInicio, dataFinal)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
        Return tab
    End Function

    Function LozalizaLancados(ByVal dataInicio As Date, ByVal dataFinal As Date) As DataTable
        objDAL = New ContasReceberDAL
        Dim tab As New DataTable
        Try
            tab = objDAL.LozalizaLancados(dataInicio, dataFinal)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
        Return tab
    End Function

    Sub inserirLancamentos(ByVal pes_codigo As Integer, ByVal cr_formaPgto As String, ByVal age_codigo As Integer, ByVal cr_valorTotal As Decimal, ByVal cr_dataLancamento As Date, ByVal pes_nome As String)
        objDAL = New ContasReceberDAL
        Try
            pCodigoContasReceber = objDAL.InserirContasAreceber(pes_codigo, cr_formaPgto, age_codigo, cr_valorTotal, cr_dataLancamento, pes_nome)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
    End Sub

    Sub InserirParcelas(cr_codigo As Integer, pr_valor As Decimal, pr_d_vencimento As Date, pr_status_pg As Char, pr_parcela As Integer)
        objDAL = New ContasReceberDAL
        Try
            objDAL.InserirParcelas(cr_codigo, pr_valor, pr_d_vencimento, pr_status_pg, pr_parcela)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
    End Sub

    Function LocalizaParcelados(ByVal dataInicio As Date, ByVal dataFinal As Date) As DataTable
        objDAL = New ContasReceberDAL
        Dim tab As New DataTable
        Try
            tab = objDAL.LocalizaParcelados(dataInicio, dataFinal)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
        Return tab
    End Function

    Function LocalizaParcelasAbertas(cr_codigo As Integer) As DataTable
        objDAL = New ContasReceberDAL
        Dim tab As New DataTable
        Try
            tab = objDAL.localizaParcelasAbertas(cr_codigo)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
        Return tab
    End Function

    Function LocalizaParcelasBaixados(cr_codigo As Integer) As DataTable
        objDAL = New ContasReceberDAL
        Dim tab As New DataTable
        Try
            tab = objDAL.localizaParcelasBaixados(cr_codigo)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
        Return tab
    End Function

    Sub BaixarParcelas(ByVal pr_codigo As Integer)
        objDAL = New ContasReceberDAL
        Try
            objDAL.BaixaParcelas(pr_codigo)
        Catch ex As Exception
            Throw ex
        End Try
        objDAL = Nothing
    End Sub
End Class
